package com.sopt.view;

import java.util.List;

import android.content.Context;
import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.sopt.friends.ChatActivity;
import com.sopt.friends.R;
import com.sopt.friends.db.FriendsDBHelper;
import com.sopt.friends.db.Constants.FriendsDB;
import com.sopt.friends.statics.FriendsStaticVars;
import com.sopt.friends.sub.FreshActivity;
import com.sopt.friends.vo.FriendsCommonItem;

public class HomeMenuEditAdapter extends FriendsCommonAdapter{
	Context mContext;
	public HomeMenuEditAdapter(Context context, int layout,
			List<FriendsCommonItem> inputList) {
		super(context, layout, inputList);
		mContext = context;
	}
	

	public View getView(int position, View convertView, ViewGroup parent) {
		final FriendsCommonItem mRowItem = mMemberList.get(position);
		LayoutInflater inflate = LayoutInflater.from(mContext);
		View mCurrentView = convertView;
		
		mCurrentView = inflate.inflate(mLayout, parent, false);
		ImageView deleteImage = (ImageView)mCurrentView.findViewById(R.id.rowHomeMenuDeleteActionButton);
		if(Integer.parseInt(mRowItem.get_id())>1)
			deleteImage.setVisibility(ImageView.VISIBLE);
		TextView mTextViewTitle = (TextView)mCurrentView.findViewById(R.id.rowHomeMenuTitle);
		TextView mTextViewCount = (TextView)mCurrentView.findViewById(R.id.rowHomeMenuCount);
		ImageView actionImage = (ImageView)mCurrentView.findViewById(R.id.rowHomeMenuNextActionButton);
		
		
		if( mTextViewTitle != null )	mTextViewTitle.setText( mRowItem.getTitle() );
		if( mTextViewCount != null )	mTextViewCount.setText( String.valueOf( mRowItem.getNewcount()) );
		
		if( actionImage != null && mRowItem.getNewcount()==0) actionImage.setVisibility(ImageView.INVISIBLE);
		
		return mCurrentView;
	}
	
	
}
